package cc.rengu.igas.share.facade.bean.cups;

import cc.rengu.oltp.service.common.enums.OltpRpcdEnum;
import cc.rengu.oltp.service.model.BizException;

import java.util.Arrays;

/**
 * F54 账户类型
 *
 * @author fangminwei
 * @date 2021/4/17
 */
@SuppressWarnings("AlibabaEnumConstantsMustHaveComment")
public enum F18_MCCEnum {

    //  目前只补充代收相关MCC    描述目前只描述费用类型, 没实际说明商户经营内容
    _4900("4900", "水电煤缴费"),
    _4814("4814", "通讯费缴费"),
    _4899("4899", "有线电视缴费"),
    _4816("4816", "网络服务费"),
    _8398("8398", "公益捐款"),
    _8211("8211", "教育缴费"),
    _8220("8220", "教育缴费"),
    _8299("8299", "教育缴费"),
    _8351("8351", "教育缴费"),
    _9311("9311", "税费缴纳"),
    _9399("9399", "税费缴纳"),
    _5960("5960", "保险"),
    _6300("6300", "保险"),
    _6015("6015", "银行还款类业务"),
    _9498("9498", "信用卡还款"),
    _6513("6513", "物业管理缴费"),
    _4458("4458", "烟草"),
    ;

    private String code;
    private String desc;

    F18_MCCEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return code + "-" + desc;
    }

    public static F18_MCCEnum find(String code) {
        F18_MCCEnum result = Arrays.stream(F18_MCCEnum.values())
                .filter(e -> e.getCode().equals(code)).findFirst().orElse(null);

        if (result == null) {
            throw new BizException(OltpRpcdEnum.PARAM_IS_EMPTY_OR_NULL.getRespCode(), "找不到对应的枚举信息" + code);
        }
        return result;
    }
}
